package com.netease.nie.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.netease.nie.mapper.AddressMapper;
import com.netease.nie.model.Address;

@Repository
public class AddressDao {
	
	@Resource
	private AddressMapper addressMapper;
	
	public List<Address> listAddressByUserId(long userId) {
		return addressMapper.listAddressByUserId(userId);
	}
	
	public Address listAddressById(long id, long userId) {
		return addressMapper.listAddressById(id);
	}
	
	public int addAddress(Address address) {
		return addressMapper.addAddress(address);
	}
	
	public int updateAddress(Address address) {
		return addressMapper.updateAddress(address);
	}

	public Address listDefaultAddressByUserId(long userId) {
		return addressMapper.listDefaultAddressByUserId(userId);
	}

	public int deleteAddressById(Long id, Long userId) {
		return addressMapper.deleteAddress(id);
	}
}
